import tplPlayer from '../template/player.art'
import utils from './utils'
import icons from './icons'

class Template {
  constructor(options) {
    this.container = options.container
    this.options = options.options
    this.init()
  }

  init() {
    this.container.innerHTML = tplPlayer({
      options: this.options,
      video: {
        pic: this.options.video.pic,
        watchServer: this.options.video.watchServer,
        urlArr: this.options.video.urlArr
      },
      icons,
      utils
    })
    this.video = this.container.querySelector('.video-js')
    // 播放大按钮
    if (this.options.mode === 0) {
      this.playButton = this.container.querySelector('.lplayer-play-icon-mode-0')
    } else {
      this.playButton = this.container.querySelector('.player_btn_bg_2')
    }
    this.videoLoad = this.container.querySelector('.lplayer-video-load')
    this.lineLoad = this.container.querySelector('.lplayer-line-load')
    this.flvErrorTips = this.container.querySelector('.lplayer-flv-error-tips')
  }
}

export default Template
